<?php 
include('../Connections/KRAPPERCON.php');
include('../Connections/Accesos.php');
?>
<div>
<input type="button" value="Buscar" onclick="searchOCs()" />
</div>

<table width="100%" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td>Fecha Creacion :</td>
    <td colspan="3">
      <input type="text" value="<?php echo $hoy; ?>"  class="tcal" name="t_ro_cini" id="t_ro_cini" />
    a 
    <input type="text" name="t_ro_cfin" id="t_ro_cfin"  class="tcal" />    </td>
    </tr>
  <tr>
    <td>Fecha Documento :</td>
    <td colspan="3">
    <input type="text" value="<?php echo $hoy; ?>" name="t_ro_dini"  class="tcal" id="t_ro_dini" />
a
<input type="text" name="t_ro_dfin" id="t_ro_dfin"  class="tcal" />    </td>
    </tr>
  <tr>
    <td>Usuario :</td>
    <td>
      <input type="text"  name="t_ro_usr" id="t_ro_usr" />    </td>
    <td><!-- Centro : --></td>
    <td>
    <!--
      <select name="cbo_ro_alm" id="cbo_ro_alm">
      <option value="0">Todos</option>
      <?php
	  	  include ('../Query_Min/getCentros.php');
	  ?>
      </select>   --> </td>
  </tr>
  <tr>
    <td>Proveedor :</td>
    <td colspan="2">
      <select name="cbo_ro_pro" id="cbo_ro_pro">
      <option value="0">Todos</option>
      <?php 
	  include ('../Query_Min/getProveedores.php');
	  ?>
      </select>    </td>
    <td>&nbsp;</td>
  </tr>
  <tr>
    <td>
      <input type="checkbox" name="chk_det_art" id="chk_det_art" onclick="detQueryOC()" />&nbsp;Detallar Orden
    </td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
  </tr>
  <tr class="trDetOC noView">
    <td>Articulo :</td>
    <td>
      <input type="text" name="t_oc_cart" id="t_oc_cart" placeholder='Codigo Articulo' />
    </td>
    <td>Estado :</td>
    <td>
      <select name="cbo_oc_sts" id="cbo_oc_sts">
      <option value="0" selected="selected">Todos</option>
      <option value="1">Pendiente</option>
      <option value="2">Concluido</option>
      </select>
    </td>
  </tr>
  <tr class="trDetOC noView">
    <td>Almacen Destino :</td>
    <td>
      <select name="cbo_oc_aart" id="cbo_oc_aart">
      <option value="" selected="selected">Todos</option>
      <?php 
	  	  $combo = '';
	  include ('../Query_Min/getAlmacenes.php');
	  echo $combo;
	  ?>
      </select>
    </td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
  </tr>

  <tr>
    <td colspan="4">
    <div id="d_rsOC"></div>    </td>
    </tr>
</table>

<script type="text/javascript">
function viewOC(obj){
	var oc = $(obj).html();
	loadPage('Procesos/MantOC.php',{ orden : oc });
}

function searchOCs(){
	var chk= 0;
	
	if (GEBI('chk_det_art').checked)
	chk = 1;

	$('#d_rsOC').loadx('Consultas/Opers/queryOCs.php',
	{
			t_ro_cini : GEBI('t_ro_cini').value,
			t_ro_cfin : GEBI('t_ro_cfin').value,
			t_ro_dini : GEBI('t_ro_dini').value,
			t_ro_dfin : GEBI('t_ro_dfin').value,
			t_ro_usr : GEBI('t_ro_usr').value,	
			cbo_ro_cen : GEBI('cbo_ro_alm').value,
			cbo_ro_pro : GEBI('cbo_ro_pro').value,
			filter_det : chk,
			t_oc_cart : GEBI('t_oc_cart').value,
			cbo_alm : GEBI('cbo_oc_aart').value,
			oc_sts : GEBI('cbo_oc_sts').value
	}
	);
}

function detQueryOC(){
	if (GEBI('chk_det_art').checked){
	$('.trDetOC').removeClass('noView');
	}
	else {
	$('.trDetOC').addClass('noView');
	}
}
</script>
